package com.sumainfor.common.config;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.core.*;

import javax.annotation.Resource;

/**
 * @Author PuaChen
 * @Create 2018-11-03 13:26
 */
@SpringBootConfiguration
public class RedisConfiguration {

    @Resource
    private RedisTemplate<String, Object> redisTemplate;

    @Bean
    public ValueOperations createValueOperations() {
        return redisTemplate.opsForValue();
    }

    @Bean
    public HashOperations createHashOperations() {
        return redisTemplate.opsForHash();
    }

    @Bean
    public ListOperations createListOperations() {
        return redisTemplate.opsForList();
    }

    @Bean
    public SetOperations createSetOperations() {
        return redisTemplate.opsForSet();
    }

    @Bean
    public ZSetOperations createZSetOperations() {
        return redisTemplate.opsForZSet();
    }
}
